package wat.serwerapp.admins;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.NamingException;
import wat.ziszcommon.invoker.Method;
import wat.serwerapp.usermgmt.ldap.MethodManager;

/**
 *
 * @author Kamil
 */
public class AddMethod implements Method {

   private static Set<String> owners;

   public Set<String> getOwners() {
      if (owners == null) {
         owners = new HashSet<String>();
         owners.add("pl.edu.wat.erp.client.administration.AddPluginClient");
      }
      return owners;
   }

   public String invoke(String parameters) {
      throw new UnsupportedOperationException("Not supported yet.");
   }

   public List invoke(List parameters) {
      try {
         String methodName = (String) parameters.get(0);
         String methodPath = (String) parameters.get(1);
         MethodManager.addMethod(methodName, methodPath);
      } catch (NamingException ex) {
         Logger.getLogger(AddMethod.class.getName()).log(Level.SEVERE, null, ex);
      }
      return new ArrayList(1);
   }
}
